/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package CONTROLLER;

import POJO.*;
import BUS.*;
import java.util.Map;
import java.util.HashMap;
import java.util.List;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;

/**
 *
 * @author Mr Long
 */
@Controller
public class ThamsoController {

    private ThamsoBUS tsBUS;

    //Lấy tham số
    @RequestMapping(value = "/capnhatthamso", method = RequestMethod.GET)
    public ModelAndView capnhatTsAction(HttpServletRequest request,
            HttpServletResponse response) throws Exception {
        response.setContentType("text/html;charset=UTF-8");
        Map<String, Object> model = new HashMap<String, Object>();
        //Do something...
        try {
        } catch (Exception ex) {
            System.err.print(ex);
        }
        return new ModelAndView("capnhatthamsoview", model);
    }

    //Xử lý thêm/cập nhật sản phẩm
    @RequestMapping(value = "submitthamso", method = RequestMethod.POST)
    public String onSubmit(@ModelAttribute("thamSo") Thamso _ts, BindingResult result,
            HttpServletRequest request, HttpServletResponse response) throws Exception {
        response.setContentType("text/html;charset=UTF-8");

        try {
            if (_ts != null) {
            }

        } catch (Exception ex) {
            System.err.print(ex);
        }
        return "redirect:/quanlithamso.html";
    }

    /**
     * @param tsBUS the tsBUS to set
     */
    @Autowired
    public void setTsBUS(ThamsoBUS tsBUS) {
        this.tsBUS = tsBUS;
    }
}
